<!DOCTYPE html>
<html>

<head>

  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">


  <title>一个多用户博客后台</title>
    <meta name="keywords" content="">
    <meta name="description" content="">
  <link rel="shortcut icon" href="favicon.ico">
  <link href="../public/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
  <link href="../public/css/font-awesome.css?v=4.4.0" rel="stylesheet">
  <link href="../public/css/animate.css" rel="stylesheet">
  <link href="../public/css/style.css?v=4.1.0" rel="stylesheet">
  <link href="../public/css/plugins/iCheck/custom.css" rel="stylesheet">

</head>

<body class="gray-bg">
  <div class="wrapper wrapper-content">
    <div class="row">
      <div class="ibox float-e-margins">
        <div class="ibox-title">
          <h5>用户管理</h5>
          <div class="ibox-tools">
            <a class="collapse-link">
              <i class="fa fa-chevron-up"></i>
            </a>
          </div>
        </div>
        <div class="ibox-content">
          <a class="btn btn-primary" href="#" data-toggle="modal" data-target="#myModal-new">新增标签</a>
          <form action="" method="POST" role="form">
            <div class="input-group col-sm-6">
              <input type="text" class="form-control" placeholder="搜索用户名称"> <span class="input-group-btn"> <button
                  type="button" class="btn btn-primary">搜索
                </button> </span>
            </div>
          </form>


          <table class="table table-bordered">
            <thead>
              <tr>
                <th>ID</th>
                <th>名称</th>
                <th>文章数量</th>
                <th>操作</th>
              </tr>
            </thead>
            <tbody>
              
                {{each tags}}
              <tr>
                <td>{{$index}}</td>
                <td><i class="fa fa-tag"></i> {{$value.tagName}}</td>
                <td>{{$value.count}}</td>
                <td style="text-align:center">
                  <a href="#" onclick="openModel('{{$value._id}}')"><i
                      class="fa fa-edit text-navy"></i></a> 编辑标签
                </td>
              </tr>
              {{/each}}

            </tbody>
          </table>

        </div>
      </div>


    </div>
  </div>



<!-- 编辑标签 -->
  <div class="modal inmodal" id="myModal" tabindex="-1" role="dialog" aria-hidden="true">
    <div class="modal-dialog">
      <div class="modal-content animated bounceInRight">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span
              class="sr-only">关闭</span>
          </button>
          <i class="fa fa-tag modal-icon"></i>
          <h4 class="modal-title">标签编辑</h4>
        </div>
        <form role="form" method="POST" >
          <div class="modal-body">

            <div class="form-group">
              <label>名称</label>
              <input type="text"  class="form-control" name="tagName">
            </div>

            <div>
              <label>
                <input type="checkbox" class="i-checks" name="isNav" value="true"> 加入导航</label>
            </div>

          </div>
          <div class="modal-footer">
            <button type="button" class="btn btn-white" data-dismiss="modal">关闭</button>
            <button type="button" class="btn btn-primary">保存</button>
          </div>
        </form>
      </div>
    </div>
  </div>

  <!-- 新建标签 -->
  <div class="modal inmodal" id="myModal-new" tabindex="-1" role="dialog" aria-hidden="true">
      <div class="modal-dialog">
        <div class="modal-content animated bounceInRight">
          <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span
                class="sr-only">关闭</span>
            </button>
            <i class="fa fa-tag modal-icon"></i>
            <h4 class="modal-title">标签编辑</h4>
          </div>
          <form role="form" id="editTag" method="POST" action="/admin/tagAdd">
            <div class="modal-body">
  
              <div class="form-group">
                <label>名称</label>
                <input type="text"  class="form-control" name="tagName">
              </div>
              <div>
                  <input type="checkbox" class="i-checks" name="isNav" value="true"> 加入导航</label>
              </div>
  
            </div>
            <div class="modal-footer">
              <button type="button" class="btn btn-white" data-dismiss="modal">关闭</button>
              <button type="submit" class="btn btn-primary">保存</button>
            </div>
          </form>
        </div>
      </div>
    </div>

  <!-- 全局js -->
  <script src="../public/js/jquery.min.js?v=2.1.4"></script>
  <script src="../public/js/bootstrap.min.js?v=3.3.6"></script>

  <!-- 自定义js -->
  <script src="../public/js/content.js"></script>
  <!-- iCheck -->
  <script src="../public/js/plugins/iCheck/icheck.min.js"></script>

<script>
     $(document).ready(function () {
      $('.i-checks').iCheck({
        checkboxClass: 'icheckbox_square-green',
        radioClass: 'iradio_square-green',
      });
    });

  function openModel(id){
    $('#editTag').attr('action','/admin/tags-edit'+id)
    $('#myModal-new').modal('show')
  }



</script>





</body>

</html>